<?php


namespace App\Utils;

use Monolog\Handler\StreamHandler;
use Monolog\Logger as Monolog;

class Logger
{
    protected static $logs = null;


    public static function getLogger($logger = null): Monolog
    {
        $logger = $logger ?? 'log';
        if (!isset(self::$logs[$logger])) {
            self::$logs[$logger] = new Monolog($logger);
            self::$logs[$logger]->pushHandler(new StreamHandler($logger . '.log'));
        }
        return self::$logs[$logger];
    }


}